window: Reset on unhandled gestures right away
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 17 Sep 2015 21:22:39 +0000 (23:22 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Fri, 18 Sep 2015 10:51:22 +0000 (12:51 +0200)
Traditionally a sequence is set to GTK_EVENT_SEQUENCE_DENIED state when
it is to be ignored, which means it is dormant, but still managed by the
gesture (accounting, "denied" sequences still make "slots" in multitouch
gesture busy, etc...).

This gesture will run for all button presses and releases in the window
though when presses happen on the "window content" region, and we can't
account for every children to be as educated as setting the proper mask
on every window, or ensuring events will be propagated as they should.

In order to cater for this, just reset the gestures, we can live without
such accounting in these specific GtkGestureSingle gestures.

https://bugzilla.gnome.org/show_bug.cgi?id=754098

gtk/gtkwindow.c

index 7cb2497ac5871e105d93f2184d55ada7061b853e..bf6d510faf0d49cb8faf2bfa8daf6698c0057b8a 100644 (file)
@@ -61,6 +61,7 @@
 #include "a11y/gtkwindowaccessible.h"
 #include "a11y/gtkcontaineraccessibleprivate.h"
 #include "gtkapplicationprivate.h"
+#include "gtkgestureprivate.h"
 #include "inspector/init.h"
 #include "inspector/window.h"
 
@@ -1450,6 +1451,14 @@ multipress_gesture_pressed_cb (GtkGestureMultiPress *gesture,
         {
           gtk_gesture_set_sequence_state (GTK_GESTURE (gesture),
                                           sequence, GTK_EVENT_SEQUENCE_DENIED);
+
+          /* Reset immediately the gestures, here we don't get many guarantees
+           * about whether the target window event mask will be complete enough
+           * to keep gestures consistent, or whether any widget across the
+           * hierarchy will be inconsistent about event handler return values.
+           */
+          gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
+          gtk_event_controller_reset (GTK_EVENT_CONTROLLER (priv->drag_gesture));
           return;
         }
       /* fall thru */